package cn.shujuhai.qtadmin.platform.domain;

import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.List;

import org.springframework.format.annotation.DateTimeFormat;

import com.baomidou.mybatisplus.annotation.*;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonInclude;

import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * @author dch sys_menu
 */
@EqualsAndHashCode(callSuper = true)
@TableName(value = "sys_menu")
@Data
@JsonInclude(JsonInclude.Include.NON_NULL)
public class SysMenu extends Model<SysMenu> implements Serializable {
    @TableField(exist = false)
    private static final long serialVersionUID = 1L;
    /**
     * 菜单ID
     */
    @TableId(type = IdType.AUTO)
    private Long id;
    /**
     * 父菜单ID
     */
    private Long parentId;
    /**
     * 菜单名
     */
    private String title;
    /**
     * 菜单URL
     */
    private String href;
    /**
     * 菜单排序
     */
    private Integer sort;
    /**
     * 菜单图标
     */
    private String icon;
    /**
     * 目标
     */
    private String target;
    /**
     * 类型:0:目录，1：菜单，2：按钮
     */
    private String type;
    /**
     * 授权（多个授权用逗号分开如sys.user.add,sys.user.edit）
     */
    private String perms;
    /**
     * 创建时间
     */
    @TableField(value = "created", fill = FieldFill.INSERT)
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime created;
    /**
     * 创建人
     */
    @TableField(value = "creator", fill = FieldFill.INSERT)
    private String creator;
    /**
     * 修改时间
     */
    @TableField(value = "edited", fill = FieldFill.INSERT_UPDATE)
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime edited;
    /**
     * 修改人
     */
    @TableField(value = "editor", fill = FieldFill.INSERT_UPDATE)
    private String editor;
    /**
     * 逻辑删除:0=未删除,1=已删除
     */
    @TableField(value = "deleted")
    private Boolean deleted;

    @TableField(exist = false)
    private List<SysMenu> child;
}